# -*- coding: UTF-8 -*
# !/usr/bin/python3
from requests.api import request
from weiboRss import app, common, rss_path, sign_key
from flask import Response, request


@app.route('/')
def index():
    return "hello"


@ app.route("/weibohot")
def weibohot():
    """
        check 
    """
    c = request.args.get("code")
    id = request.args.get("id")
    if not id or not c:
        return "error params"
    rel = common.checkCode(sign_key,c,int(id))
    if rel == False:
        return "error code"
    xml = open(rss_path+'/WeiboHot.xml')
    r = Response(response=xml, status=200, mimetype="application/xml")
    r.headers["Content-Type"] = "text/plain; charset=utf-8"
    return r
